﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>客户订单管理</title>
    <#include "../common/link.ftl"/>

    <script>
        $(function () {
            $("#select").val(${(qo.classinfoId)!});

            /*----------------------模态框---------------------------*/

            $(".btn-input").click(function () {
                $("#editForm input").val("");  //清空模态框数据
                var json = $(this).data("json"); //获取客户订单数据
                if (json) {
                    $("#editForm input[name=id]").val(json.id);          //回显数据
                    $("#editForm select[name='customer.id']").val(json.customer.id);          //回显数据
                    $("#editForm select[name='classinfo.id']").val(json.classinfo.id);          //回显数据
                    $("#editForm input[name=money]").val(json.money);          //回显数据

                }
                $('#input-modal').modal('show')     //显示模态框
            });

            $("#editForm").ajaxForm(handlerMessage);

        });

    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl"/>

    <!--菜单回显-->
    <#assign currentMenu="courseorder"/>

    <#include "../common/menu.ftl"/>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>客户订单管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/courseorder/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <label for="keyword" class="control-label">关键字：</label>
                    <input type="text" id="keyword" placeholder="请输入客户名称" name="keyword" value="${qo.keyword!}">
                    <select class="form-control" name="classinfoId" id="select">
                        <option value="-1" class="">请选择班级课程</option>
                        <#list classinfos as classinfo >
                            <option value="${classinfo.id}" class="">${classinfo.name}</option>
                        </#list>
                    </select>

                    <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询
                    </button>
                    <a href="#" class="btn btn-success btn-input" style="margin: 10px">
                        <span class="glyphicon glyphicon-plus"></span> 添加
                    </a>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>客户名称</th>
                            <th>班级课程</th>
                            <th>销售时间</th>
                            <th>销售金额</th>
                            <th>操作</th>

                        </tr>
                        <#list pageInfo.list as courseorder>
                            <tr>
                                <td>${courseorder_index+1}</td>
                                <td>${courseorder.customer.name}</td>
                                <td>${courseorder.classinfo.name}</td>
                                <td>${courseorder.inputTime?string("yyyy-MM-dd")}</td>
                                <td>${courseorder.money}</td>
                                <td>
                                    <a href="#" id="editButton" data-json='${courseorder.json}'
                                       class="btn btn-info btn-xs btn-input">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                </td>
                            </tr>
                        </#list>
                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl"/>
                </div>
            </div>
        </section>
    </div>
    <#--<%@include file="/WEB-INF/views/common/footer.jsp"%>-->
    <#include "../common/footer.ftl"/>
</div>

<#---------------------模态框------------------------------->
<div class="modal fade " id="input-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">添加或编辑客户订单</h4>
            </div>
            <form class="form-horizontal" action="/courseorder/saveOrUpdate" method="post" id="editForm">
                <div class="modal-body">
                    <p>
                        <input type="hidden" name="id">

                    <div class="form-group" style="margin-top: 10px;">
                        <label for="sn" class="col-sm-3 control-label">客户姓名：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="customer.id">
                                <option value="-1" class="">请选择客户姓名</option>
                                <#list customers as customer >
                                    <option value="${customer.id}" class="">${customer.name}</option>
                                </#list>
                            </select>
                        </div>
                    </div>

                    <div class="form-group" style="margin-top: 10px;">
                        <label for="sn" class="col-sm-3 control-label">班级课程：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="classinfo.id">
                                <option value="-1" class="">请选择班级课程</option>
                                <#list classinfos as classinfo >
                                    <option value="${classinfo.id}" class="">${classinfo.name}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="sn" class="col-sm-3 control-label">课程金额：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="money"
                                   placeholder="请输入班级金额">
                        </div>
                    </div>

                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button id="submitBtn" type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>

</body>
</html>
